<?php
include("inc.php");
if($urlmodel==1)
{
	$urlstr=$_SERVER["REQUEST_URI"]==$_SERVER['SCRIPT_NAME']?"":str_replace($_SERVER['SCRIPT_NAME'],"",$_SERVER["REQUEST_URI"]);
	if($urlstr&&preg_match("/\/.*\/([0-9]+)-p([0-9]+).html/",$urlstr,$regs))
	{
		$_GET['wid']=$regs[1];
		$_GET['pid']=$regs[2];
		unset($regs);
	}
	else die("sorry");
	unset($urlstr);
}
$wid=$_GET['wid'];
$rs=mysql_query("SELECT * FROM `word` WHERE `wid` ={$wid} LIMIT 1");
if(@mysql_num_rows($rs))
{
	$rw=mysql_fetch_assoc($rs);
	$word=$rw['word'];
	$pinyin=$rw['pinyin'];
	$updatetime=$rw['updatetime'];
}
else die("none");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$word?> -- <?=$sitename?> | <?=$sitenameadd?></title>
<meta name="keywords" content="<?=$word?>" />
<meta name="description" content="One article talk about <?=$word?> " />
<base href="<?=$baseurl?>">
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
<div id="head">
<a href="./"><?=$sitename?></a>-<a href="wordlist.php/1/"><?=$sitenameadd?></a>
</div>
<div id="h">
  <div id="googlelink728X15">
  <script type="text/javascript"><!--
  google_ad_client = "pub-3493786795582708";
  google_ad_format = "js_sdo";
  google_cts_mode ="rs";
  google_num_cts = "2";
  google_searchbox_width = 215;
  google_searchbox_height = 26;
  google_link_target = 2;
  google_ad_channel = "6297994744";
  google_logo_pos = "left";
  google_rs_pos = "right";
  google_ad_height = 35;
  google_ad_width = 920;
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_sdo.js">
</script>

  </div>
</div>
<div style="height:90px;width:950px;margin:0 auto; margin-bottom:6px;margin-top:6px;">
<a href="http://www.51taonan.com/m/000234" rel="nofollow" target="_blank"><img src="http://www.51taonan.com/static/zh_cn/insidepage/market/default/images/staff/950_90.gif" border="0"/></a>
</div>
<?
if(time()-strtotime($updatetime)>$listupdatetime)
{
	$encodeword=urlencode($word." site:qzone.qq.com");
	//$articleurl="http://blogsearch.google.cn/blogsearch_feeds?hl=en&q={$encodeword}&lr=&scoring=d&ie=utf-8&num=10&output=rss";
	$articleurl="http://vdap.soso.com/rss?w={$encodeword}&kd=b&sd=0&nu=20&src=-1&ie=utf-8";
	//echo "$articleurl";
	//$articlepattern="<item>[.\n]*<title>(.*)<\/title>[.\n]*<link>(.*)<\/link>[.\n]*<description>(.*)<\/description>.*<dc:creator>(.*)<\/dc:creator>";
	$articlepattern="<item>[\s\S]*?<title><!\[CDATA\[([\s\S]*?)\]\]><\/title>[\s\S]*?<link><!\[CDATA\[([\s\S]*?)\]\]><\/link>[\s\S]*?<description><!\[CDATA\[([\s\S]*?)<br \/><br \/><br \/>-{10,}[\s\S]*?<pubDate><!\[CDATA\[([\s\S]*?)\]\]><\/pubDate>[\s\S]*?<source><!\[CDATA\[([\s\S]*?)\]\]><\/source>[\s\S]*?<author><!\[CDATA\[([\s\S]*?)\]\]><\/author>[\s\S]*?<\/item>";
	fetweb_soso($word,$wid,$articleurl,$articlepattern,0);
}
?>
<div id="l">
<div id="articlelist">
<div ><a href="./"><?=$sitename?></a> -> <a href="wordlist.php/1/"><?=$lang['alltopic']?></a> -> <?=$word?></div>

<div id="google728x90">
<script type="text/javascript"><!--
google_ad_client = "pub-3493786795582708";
/* 728x90, ������ 09-12-14 */
google_ad_slot = "6503528725";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

<?
$pid=isset($_GET['pid'])?$_GET['pid']:1;
$pagenum=10;
$begin=($pid-1)*$pagenum;
$rs=mysql_query("SELECT `aid` , `title` , `description` , `pinyin` FROM `article` WHERE `wid` ={$wid} LIMIT {$begin} , {$pagenum}");
if(@mysql_num_rows($rs))
{
	while ($rw=mysql_fetch_assoc($rs))
	{
?>
<div id="link"><a href="view.php/<?=$pinyin?>/<?=$rw['pinyin']?>-<?=$rw['aid']?>.html"><?=$rw['title']?></a></div>
<div id="desc"><?=$rw['description']?></div>
<?
	}
}
else echo "{$word} sorry ,but none .";
$page=pagelistnum("SELECT count(`aid`) FROM `article` WHERE `wid` ={$wid}",$pagenum,$pid,"list.php/{$pinyin}/{$wid}-p",".html");
?>
<div id="page"><?=$page?></div>
</div>

</div>
<div id="r">
<?php $i=rand(1,10);if(file_exists("smile/{$i}.jpg")){?>
<div id="pic"><img src="smile/<?=$i?>.jpg"></div>
<?}?>
<div id="google200X200">
<iframe scrolling="no" frameborder="0" marginheight="0" marginwidth="0" width="200" height="235" src="http://u.www.duba.net/union/db/style_1283.html?uid=41223&sid=0" id="ksu_style_1283"></iframe>
</div>
<div id="google200X200">
<script type="text/javascript"><!--
google_ad_client = "pub-3493786795582708";
/* 200x200, ������ 09-12-14 */
google_ad_slot = "4616496781";
google_ad_width = 200;
google_ad_height = 200;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div id="w">
<?
$rs=mysql_query("SELECT `wid` , `word` , `pinyin` FROM `word` ORDER BY RAND() LIMIT 0 , 10");
if($rs)
{
	while ($rw=mysql_fetch_assoc($rs))
	{
?>
<a href="list.php/<?=$rw['pinyin']?>/<?=$rw['wid']?>-p1.html"><?=$rw['word']?></a>
<?
	}
}
?>
</div>
</div>
<?php include("footer.php");?>